package com.jwdf.uda.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

import com.jwdf.uda.R;

/**
 * 类说明：
 */
public class VoteRatioView extends LinearLayout{
    private ProgressBar mProgressBar;
    public VoteRatioView(Context context){
        this(context, null);
    }
    public VoteRatioView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    private void initView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.view_vote_ratio, null, false);
        mProgressBar = (ProgressBar) view.findViewById(R.id.pgRatio);
        addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    }

    public void setProgress(int progress){
        mProgressBar.setProgress(progress);
    }

    public void setProgressDrawable(int drawableId){
        mProgressBar.setProgressDrawable(getContext().getResources().getDrawable(drawableId));
    }


}
